package com.zhanglinfeng.api.service;

import com.zhanglinfeng.api.config.FeignClientConfig;
import com.zhanglinfeng.api.response.ResultResponse;
import com.zhanglinfeng.api.service.impl.TestFeignImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * name：指定提供者的名字
 * fallback：降级处理类
 * configuration：替换默认的配置
 */
@FeignClient(name = "eureka-client", fallback = TestFeignImpl.class, configuration = {FeignClientConfig.class})
public interface TestFeign {

    @GetMapping(value = "/queryServices", produces = MediaType.APPLICATION_JSON_VALUE)
    ResultResponse<List<String>> queryServices();

    @PostMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String handleFileUpload(@RequestPart(value = "file") MultipartFile file);
}
